package main

import (
	"log"

	"github.com/cloudwego/biz-demo/gomall/demo/demo_proto/biz/dal"
	"github.com/cloudwego/biz-demo/gomall/demo/demo_proto/biz/dal/mysql"
	"github.com/cloudwego/biz-demo/gomall/demo/demo_proto/biz/model"
	"github.com/joho/godotenv"
)

func main() {
	err := godotenv.Load()
	if err != nil {
		log.Fatal("Error loading .env file")
	}
	dal.Init()
	// CRUD operations
	// mysql.DB.Create(&model.User{Email: "demo@example.com", Password: "fdafafddafdsf"})
	// mysql.DB.Model(&model.User{}).Where("email = ?", "demo@example.com").Update("password", "22222222")
	// var row model.User
	// mysql.DB.Model(&model.User{}).Where("email = ?", "demo@example.com").First(&row)
	// fmt.Printf("result: %v\n", row)
	mysql.DB.Model(&model.User{}).Where("email = ?", "demo@example.com").Delete(&model.User{})
}
